package io.renren.modules.generator.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.TTrainingDictionaryDao;
import io.renren.modules.generator.entity.TTrainingDictionaryEntity;
import io.renren.modules.generator.service.TTrainingDictionaryService;


@Service("tTrainingDictionaryService")
public class TTrainingDictionaryServiceImpl extends ServiceImpl<TTrainingDictionaryDao, TTrainingDictionaryEntity> implements TTrainingDictionaryService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String typeName = (String)params.get("typeName");
        IPage<TTrainingDictionaryEntity> page = this.page(
                new Query<TTrainingDictionaryEntity>().getPage(params),
                new QueryWrapper<TTrainingDictionaryEntity>().like(StringUtils.isNotBlank(typeName),"type_name", typeName).orderByDesc("id")
        );

        return new PageUtils(page);
    }

}